package cn.rengy.web.demo.mangodb;

import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.bson.types.ObjectId;


@Configuration
public class ObjectIdConfiguration {



	@Bean
	public Jackson2ObjectMapperBuilderCustomizer objectIdCustomizer() {
        return jacksonObjectMapperBuilder -> {
            //
            jacksonObjectMapperBuilder
                    .serializerByType(ObjectId.class, ToStringSerializer.instance)
            ;
        };
	}
}
